#!/usr/bin/env bash

base_path=$(cd `dirname $0`; pwd)

p_name_arr[0]="$base_path/server.py"

for p_name in ${p_name_arr[*]};do
    pid=$(ps aux | grep "$p_name" | grep -v grep | awk '{print $2}')
    if [ -n "$pid" ];then
        kill -9 $pid
        echo "$p_name killed ok"
    else
        echo "$p_name pid is empty"
    fi
done


python "$base_path/server.py"    1>>/dev/null 2>&1 &
echo "$base_path/server.py stared"
# set fileformat=unix